package com.bky.config;

/**
 * @author shipeilei
 * @date 2017/4/22
 */
public enum CacheKeyEnum {

    /**
     * 登录缓存 KEY_USER_ID
     */
    KEY_USER("KEY_USER_%s", 3 * 60),
    KEY_ADD("KEY_ADD_%s", 7 * 24 * 60 * 60);

    private String format;
    //单位：秒
    private int exp;

    CacheKeyEnum(String format, int exp) {
        this.format = format;
        this.exp = exp;
    }

    public String format(Object... values) {
        return String.format(format, values) + "_V1";
    }

    public int getExp() {
        return exp;
    }

    @Override
    public String toString() {
        return "CacheKeyEnum{" +
                "format='" + format + '\'' +
                ", exp=" + exp +
                '}';
    }
}
